<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<div class="pageContent">
	<form method="post" action="${rootUrl}/system/user/${user.id}" class="pageForm required-validate" onsubmit="return validateCallback(this, newDialogAjaxDone);">
	<input type="hidden" name="_method" value="put">
		<div class="pageFormContent" layoutH="56">
			<p>
				<label>登录名：</label>
				<input name="user.username" class="required" type="text" readonly="readonly" size="30" value="${user.username}" />
			</p>
			<p>
				<label>姓名：</label>
				<input name="user.name" class="required"  type="text" size="30" value="${user.name}" />
			</p>
			<p>
				<label>密码：</label>
				<input name="user.password"  type="password" size="30" value="" />
			</p>
			<p>
				<label>重复密码：</label>
				<input name="password"  type="password" size="30" value="" />
			</p>
			<p>
				<label>状态：</label>
				<select name="user.enabled" class="combox">
				<c:if test="${user.enabled==true}"><option value="true">正常</option></c:if>
				<c:if test="${user.enabled==false}"><option value="false">锁定</option></c:if>
				<option value="true">正常</option>
				<option value="false">锁定</option>
				</select>
			</p>
			
			<div class="divider"></div>

				<div>
					<table class="list nowrap itemDetail" addButton="增加部门职位" width="50%">
						<thead>
							<tr>
								<th type="lookup" lookuppk="code" name="deplist[#index#].name" lookupGroup="deplist[#index#]" lookupUrl="${rootUrl}/system/department!treeLookup" suggestUrl="${rootUrl}/system/department!lookupSuggest" suggestFields="name" postField="keywords" size="12" fieldClass="required">部门名称</th>
								<th type="lookup" lookuppk="code"  warn="请选择部门！"  name="poslist[#index#].name" lookupGroup="poslist[#index#]" lookupUrl="${rootUrl}/system/position/{deplist[#index#]}/treeLookup" suggestUrl="${rootUrl}/system/position/{deplist[#index#]}/lookupSuggest" suggestFields="name" postField="keywords" size="12" fieldClass="required">职位名称</th>
							    <th type="del" width="60">操作</th>
							</tr>
						</thead>
						<tbody>
						<c:forEach items="${user.department_position}" var="d_p" varStatus="status">
							<tr class="unitBox">
								<td>
									<input type="hidden" name="deplist[${status.index}].code" id="deplist_${status.index}_" value="${d_p.department.id}" />
									<input type="text" class="required textInput valid" size="12" value="${d_p.department.name}" lookuppk="code" postfield="keywords" suggestfields="name" suggesturl="${rootUrl}/system/department!lookupSuggest" lookupgroup="deplist[${status.index}]" autocomplete="off" name="deplist[${status.index}].name" />
									<a title="查找带回" lookuppk="code" postfield="keywords" suggestfields="name" suggesturl="${rootUrl}/system/department!lookupSuggest" autocomplete="off" lookupgroup="deplist[${status.index}]" href="${rootUrl}/system/department!treeLookup" class="btnLook">查找带回</a>
								</td>
								<td>
									<input type="hidden" name="poslist[${status.index}].code" id="poslist_${status.index}_" value="${d_p.position.id}" />
									<input type="text" class="required textInput valid" size="12" value="${d_p.position.name}"  lookuppk="code" postfield="keywords" suggestfields="name" suggesturl="${rootUrl}/system/position/{deplist_${status.index}_}/lookupSuggest" lookupgroup="poslist[${status.index}]" autocomplete="off" name="poslist[${status.index}].name" warn="请选择部门！" />
									<a title="查找带回" lookuppk="code" postfield="keywords" suggestfields="name" suggesturl="${rootUrl}/system/position/{deplist_${status.index}_}/lookupSuggest" autocomplete="off" lookupgroup="poslist[${status.index}]" href="${rootUrl}/system/position/{deplist_${status.index}_}/treeLookup" warn="请选择部门！" class="btnLook">查找带回</a>
								</td>
								<td>
									<a class="btnDel " href="javascript:void(0)">删除</a>
								</td>
							</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
				
			<div class="divider"></div>


			<p style="width: 800px;">
				<label>用户组：</label>
				<c:forEach items="${groups}" var="group">
				<c:choose>
				<c:when test="${userGroup[group.code]==group.name}">
				<input type="checkbox" name="group" checked="checked" value="${group.id}" />${group.name}
				</c:when>
				<c:otherwise>
				<input type="checkbox" name="group" value="${group.id}" />${group.name}
				</c:otherwise>
				</c:choose>
				</c:forEach>
			</p>
	
			<p style="width: 800px;">
				<label>角色：</label>
				<c:forEach items="${roles}" var="role">
				<c:choose>
				<c:when test="${userRole[role.code]==role.name}">
				<input type="checkbox" name="role"  checked="checked"  value="${role.id}" />${role.name}
				</c:when>
				<c:otherwise>
				<input type="checkbox" name="role" value="${role.id}" />${role.name}
				</c:otherwise>
				</c:choose>
				
				</c:forEach>
			</p>
	

		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">保存</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">取消</button></div></div>
				</li>
			</ul>
		</div>
	</form>
</div>